# Maintainer: amateurece <ethan.twardy at gmail dot com>

pkgname=sdbusplus-git
pkgver=r885.5e36f4ab
pkgrel=1
pkgdesc="C++ bindings for systemd dbus APIs"
url="https://github.com/openbmc/sdbusplus"
arch=('i686' 'x86_64' 'aarch64')
license=('Apache')
depends=("gcc-libs" "glibc" "nlohmann-json" "python" "python-inflection" "python-jsonschema" "python-mako" "python-yaml" "systemd-libs")
makedepends=("boost-libs" "cmake" "git" "meson" "ninja" "pkgconf" "python-build" "python-installer" "python-setuptools" "python-wheel")
source=("${pkgname}::git+https://github.com/openbmc/sdbusplus.git")
sha256sums=('SKIP')

_meson_setup() {
    arch-meson -Dtests=disabled -Dexamples=disabled "${pkgname}" build
}

prepare() {
    _meson_setup
}

pkgver() {
    cd "${pkgname}"
    echo "r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
}

build() {
    _meson_setup
    meson compile -C build

    # Python tools
    cd "${pkgname}/tools"
    python -m build --wheel --no-isolation
}

package() {
    meson install -C build --destdir "$pkgdir"
    cd "${pkgname}/tools"
    python -m installer --destdir="$pkgdir" dist/*.whl
}
